Part Number Hot Search : 
PCA1127A DMN60 SC146 CX4VSM4 UAA3515A P0603 PCF85 LN2003
Product Description
Full Text Search
 

To Download AN980 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  AN980/0802 1/8 AN980 application note st7 keypad decoding techniques, implementing wake-up on keystroke by 8-bit micro application laboratory introduction the goal of this application note is to present an example of the use of the halt mode. in this application, the mcu (here a st72f264) is waked up by an external interrupt caused by someone pressed a key on the 4x4 matrixed keypad. 1
2/8 st7 keypad decoding techniques, implementing wake-up on keystroke 1 st7 / keyboard interface rows are connected to inputs with pull-up and interrupts (port c). columns are connected to port a configured as output. the result of the interrupt (the value of the pressed key) is sent on leds (port b) and stored into the x register. in our configuration, we have to add 4 pull-up re- sistors on port a (from pa0 to pa3) to be able to apply a high level on the corresponding pads. figure 1. st7 / keypad interface set-up st7 8x560 pc0 pc1 pc2 pc3 pa0 pa1 pa2 pa3 v dd gnd 4x100k 2
3/8 st7 keypad decoding techniques, implementing wake-up on keystroke 2 st72f264 configuration the application has been validated with a st72f264. its configuration is described in this part. refer to your datasheet for more details. 2.1 i/o control rows are connected to pins configured as inputs (port c as input with pull up and interrupts). columns are connected to pins configured as outputs (port a). external interrupts are caused by a low level applied to a pin of port c (caused by a key pressed), they wake up the mcu which was in halt mode. port b is configured as outputs to send the value of the pressed key on leds. please, refer to the data book to configure pins properly. 2.2 miscellaneous register bits 7 and 6 have to be set to configure events correctly: the external interrupt (ei1) has here to be caused by a falling edge only. please, refer to the datasheet for more details. 2.3 halt mode the halt instruction places the st72f264 in its lowest power consumption mode. the core and all peripherals are frozen. in this mode, the internal oscillator is turned off, causing all in- ternal processing to be halted. the data remain unchanged. during the halt mode, external interrupts are still enabled. the mcu stays in this state until an external interrupt or a reset oc- curs. then the internal oscillator is restarted and the core waits for 4096 cpu clock cycles (512 s for a f cpu = 8mhz) before running the external interrupt subroutine. then the mcu comes back to the main program (in our application to the halt state). please, refer to the datasheet for more details.
4/8 st7 keypad decoding techniques, implementing wake-up on keystroke 3 external interrupts the mcu is in halt mode. when a key is pressed, a low level is applied to the pin corre- sponding to the row the key belongs (pins configured as inputs with pull-up). its a falling edge applied to a pin of port c which creates an external interrupt (ei1) and wakes up the mcu. the mcu executes then the external interrupt subroutine (decoding the pressed key) and comes back to its previous state (halt state in the main program). 4 keypad the keypad used is a 4x4 matrixed keypad. rows are connected to pins configured as inputs with pull-up. so the initial state of these pins are a high level (1). when a key is pressed, a low level is applied to the corresponding pin. for this reason, the keypad is coded as follows: table 1. key values key row value column value key row value column value 1 0x0e 0x0e 7 0x0b 0x0e 2 0x0e 0x0d 8 0x0b 0x0d 3 0x0e 0x0b 9 0x0b 0x0b f 0x0e 0x07 d 0x0b 0x07 4 0x0d 0x0e a 0x07 0x0e 5 0x0d 0x0d 0 0x07 0x0d 6 0x0d 0x0b b 0x07 0x0b e 0x0d 0x07 c 0x07 0x07 123f 456 e 7 8 9 d a 0 b c pc0 pc1 pc2 pc3 pa0 pa1 pa2 pa3
5/8 st7 keypad decoding techniques, implementing wake-up on keystroke you have to press the chosen key at least 0.5 to 1 second depending on which key you choose (table read from keypad_top to keypad). the faster the key is read into the table, the faster it will be decoded and the faster the result will be sent on leds. the keypad code is in the file constant.asm as follows: .keypad dc.b $0e,$0e,$1 ;pc0 pa0 dc.b $0e,$0d,$2 ;pc0 pa1 dc.b $0e,$0b,$3 ;pc0 pa2 dc.b $0e,$07,$f ;pc0 pa3 dc.b $0d,$0e,$4 ;pc1 pa0 dc.b $0d,$0d,$5 ;pc1 pa1 dc.b $0d,$0b,$6 ;pc1 pa2 dc.b $0d,$07,$e ;pc1 pa3 dc.b $0b,$0e,$7 ;pc2 pa0 dc.b $0b,$0d,$8 ;pc2 pa1 dc.b $0b,$0b,$9 ;pc2 pa2 dc.b $0b,$07,$d ;pc2 pa3 dc.b $07,$0e,$a ;pc3 pa0 dc.b $07,$0d,$0 ;pc3 pa1 dc.b $07,$0b,$b ;pc3 pa2 keypad_top dc.b $07,$07,$c ;pc3 pa3
6/8 st7 keypad decoding techniques, implementing wake-up on keystroke 5 flowcharts figure 2. flowchart: main program figure 3. flowchart: external interrupt (ei1) initializations halt infinite loop x = 48 (3x16 coded values) one column activated yes corresponding value of the pressed key stored into a, x and sent on leds exit no store into x next column is there a low level on the intersection of the stored row and column? value (pa0...pa3)
7/8 st7 keypad decoding techniques, implementing wake-up on keystroke 6 software all the source files in assembly code are given in the zip file with this application note. the source files are for guidance only. stmicroelectronics shall not be held liable for any di- rect, indirect or consequential damages with respect to any claims arising from use of this soft- ware.
8/8 st7 keypad decoding techniques, implementing wake-up on keystroke the present note which is for guidance only aims at providing customers with information regarding their products in order for them to save time. as a result, stmicroelectronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from the content of such a note and/or the use made by customers of the information contained herein in connection with their products. information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 2002 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - canada - china - finland - france - germany - hong kong - india - israel - italy - japan malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - u.s.a. http://www.st.com


▲Up To Search▲   

 
Price & Availability of AN980

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X